package com.qm.console.controller.dto.version;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;

import java.util.List;

public class AppChannelListDTO {
    @JSONField(name = "channel")
    private List<String> channelList;

    public AppChannelListDTO() {
    }

    public AppChannelListDTO(List<String> channelList) {
        this.channelList = channelList;
    }

    public List<String> getChannelList() {
        return channelList;
    }

    public void setChannelList(List<String> channelList) {
        this.channelList = channelList;
    }

    public static AppChannelListDTO parseObject(String channels){
        AppChannelListDTO channelListDTO;
        try {
            channelListDTO = JSONObject.parseObject(channels, AppChannelListDTO.class);
        }catch (Exception e){
            channelListDTO = null;
        }
        return channelListDTO;
    }

    public static String toJsonString(AppChannelListDTO channelListDTO){
        if(channelListDTO == null){
            return null;
        }
        return JSONObject.toJSONString(channelListDTO);
    }
}
